﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Public;
using System.Data;
namespace DAL
{
    public class SanBayDAL
    {
        clsKetNoi kn = new clsKetNoi();
        public DataTable LoadSanBay()
        {
            return kn.LayDuLieu("SanBay_Load");
        }
        public int ThemSanBay(SanBayPublic p)
        { 
            int Nparameter = 2;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];
            name[0] = "@MaSanBay"; value[0] = p.MaSanBay;
            name[1] = "@TenSanBay"; value[1] = p.TenSanBay;
            return kn.Update("SanBay_Insert",name,value,Nparameter);
        }
        public DataTable LoadSanBayTheoTuyenBay(SanBayPublic p)
        {
            int Nparameter = 1;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];
            name[0] = "@MaSanBay"; value[0] = p.MaSanBay;
            return kn.LayDuLieu("SanBayDen_TuyenBay", name, value, Nparameter);
        }
        public DataTable LoadSanBayTheoTen(SanBayPublic p)
        {
            int Nparameter = 1;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];
            name[0] = "@SanBayDen"; value[0] = p.MaSanBay;
            return kn.LayDuLieu("LayTenSBDen", name, value, Nparameter);
        }
       
    }
}
